//    |  /           |
//    ' /   __| _` | __|  _ \   __|
//    . \  |   (   | |   (   |\__ \.
//   _|\_\_|  \__,_|\__|\___/ ____/
//                   Multi-Physics
//
//  License:		 BSD License
//					 Kratos default license: kratos/license.txt
//
//  Main authors:    Bodhinanda Chandra
//
//


#include "mpm_application_variables.h"

namespace Kratos
{
    // Unused variables
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( NODAL_INTERNAL_FORCE )

    // Element
    KRATOS_CREATE_VARIABLE( int, MP_MATERIAL_ID )
    KRATOS_CREATE_VARIABLE( int, MATERIAL_POINTS_PER_ELEMENT )
    KRATOS_CREATE_VARIABLE( int, MP_SUB_POINTS)
    KRATOS_CREATE_VARIABLE( double, MP_MASS )
    KRATOS_CREATE_VARIABLE( double, MP_DENSITY )
    KRATOS_CREATE_VARIABLE( double, MP_VOLUME )
    KRATOS_CREATE_VARIABLE( double, MP_POTENTIAL_ENERGY )
    KRATOS_CREATE_VARIABLE( double, MP_KINETIC_ENERGY )
    KRATOS_CREATE_VARIABLE( double, MP_STRAIN_ENERGY )
    KRATOS_CREATE_VARIABLE( double, MP_TOTAL_ENERGY )
    KRATOS_CREATE_VARIABLE( double, MP_PRESSURE )
    KRATOS_CREATE_VARIABLE( double, PRESSURE_REACTION )
    KRATOS_CREATE_VARIABLE( double, MP_EQUIVALENT_STRESS)
    KRATOS_CREATE_VARIABLE( double, MP_DELTA_PLASTIC_STRAIN )
    KRATOS_CREATE_VARIABLE( double, MP_DELTA_PLASTIC_VOLUMETRIC_STRAIN )
    KRATOS_CREATE_VARIABLE( double, MP_DELTA_PLASTIC_DEVIATORIC_STRAIN )
    KRATOS_CREATE_VARIABLE( double, MP_EQUIVALENT_PLASTIC_STRAIN )
    KRATOS_CREATE_VARIABLE( double, MP_EQUIVALENT_PLASTIC_STRAIN_RATE)
    KRATOS_CREATE_VARIABLE( double, MP_ACCUMULATED_PLASTIC_VOLUMETRIC_STRAIN )
    KRATOS_CREATE_VARIABLE( double, MP_ACCUMULATED_PLASTIC_DEVIATORIC_STRAIN )
    KRATOS_CREATE_VARIABLE( double, MP_TEMPERATURE)
    KRATOS_CREATE_VARIABLE( double, NODAL_MPRESSURE )
    KRATOS_CREATE_VARIABLE(bool, IS_COMPRESSIBLE)
    KRATOS_CREATE_VARIABLE(bool, IS_MIXED_FORMULATION)

    // Constitutive Law
    KRATOS_CREATE_VARIABLE( ConstitutiveLaw::Pointer, CONSTITUTIVE_LAW_POINTER )
    // CL: Solid
    KRATOS_CREATE_VARIABLE( double, RAYLEIGH_ALPHA )
    KRATOS_CREATE_VARIABLE( double, RAYLEIGH_BETA )
    // CL: Mohr Coulomb
    KRATOS_CREATE_VARIABLE( double, COHESION )
    KRATOS_CREATE_VARIABLE( double, INTERNAL_DILATANCY_ANGLE )
    // CL: Mohr Coulomb Strain Softening
    KRATOS_CREATE_VARIABLE( double, INTERNAL_FRICTION_ANGLE_RESIDUAL )
    KRATOS_CREATE_VARIABLE( double, COHESION_RESIDUAL )
    KRATOS_CREATE_VARIABLE( double, INTERNAL_DILATANCY_ANGLE_RESIDUAL )
    KRATOS_CREATE_VARIABLE( double, SHAPE_FUNCTION_BETA )
    // CL: Johnson Cook
    KRATOS_CREATE_VARIABLE( double, REFERENCE_STRAIN_RATE)
    KRATOS_CREATE_VARIABLE( double, TAYLOR_QUINNEY_COEFFICIENT)
    KRATOS_CREATE_VARIABLE( double, MP_HARDENING_RATIO)

    // Mesh variables
    KRATOS_CREATE_VARIABLE(std::vector<typename Geometry<Node>::Pointer>, GEOMETRY_NEIGHBOURS)

    // Conditions
    // Essential Boundary Conditions
    KRATOS_CREATE_VARIABLE( double, PENALTY_FACTOR )
    KRATOS_CREATE_VARIABLE( int, MPC_BOUNDARY_CONDITION_TYPE )
    KRATOS_CREATE_VARIABLE( bool, PARTICLE_BASED_SLIP )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( WEIGHTED_VECTOR_RESIDUAL )
    KRATOS_CREATE_VARIABLE( Node::Pointer, MPC_LAGRANGE_NODE )
    KRATOS_CREATE_VARIABLE( int, MP_COUNTER )

    // Nodal load variables
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(POINT_LOAD)
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(LINE_LOAD)
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(SURFACE_LOAD)

    // MP element variable
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MP_COORD )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MP_DISPLACEMENT )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MP_VELOCITY )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MP_ACCELERATION )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MP_VOLUME_ACCELERATION )
    KRATOS_CREATE_VARIABLE( Vector, MP_CAUCHY_STRESS_VECTOR )
    KRATOS_CREATE_VARIABLE( Vector, MP_ALMANSI_STRAIN_VECTOR )

    // MP condition variable
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_COORD )
    KRATOS_CREATE_VARIABLE( int, MPC_CONDITION_ID )
    KRATOS_CREATE_VARIABLE( bool, MPC_IS_NEUMANN )
    KRATOS_CREATE_VARIABLE( double, MPC_AREA )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_NORMAL )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_DISPLACEMENT )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_DELTA_DISPLACEMENT )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_IMPOSED_DISPLACEMENT )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_VELOCITY )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_IMPOSED_VELOCITY )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_ACCELERATION )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_IMPOSED_ACCELERATION )
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( MPC_CONTACT_FORCE )
    KRATOS_CREATE_VARIABLE( int, MATERIAL_POINTS_PER_CONDITION )
    KRATOS_CREATE_VARIABLE( bool, IS_EQUAL_DISTRIBUTED )
    KRATOS_CREATE_VARIABLE( bool, MPC_CALCULATE_NODAL_REACTIONS )
    KRATOS_CREATE_VARIABLE( bool, MPC_CALCULATE_CONTACT_FORCE )

    // Grid node variable
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( NODAL_MOMENTUM)
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( NODAL_INERTIA)

    // Solver related variables
    KRATOS_CREATE_VARIABLE(bool, IGNORE_GEOMETRIC_STIFFNESS)
    KRATOS_CREATE_VARIABLE(bool, IS_AXISYMMETRIC)
    KRATOS_CREATE_VARIABLE(bool, IS_PQMPM)
    KRATOS_CREATE_VARIABLE(bool, IS_MAKE_NORMAL_MP_IF_PQMPM_FAILS)
    KRATOS_CREATE_VARIABLE(double, PQMPM_SUBPOINT_MIN_VOLUME_FRACTION)

    // Explicit time integration variables
    KRATOS_CREATE_VARIABLE(bool, CALCULATE_MUSL_VELOCITY_FIELD)
    KRATOS_CREATE_VARIABLE(bool, IS_EXPLICIT)
    KRATOS_CREATE_VARIABLE(bool, IS_EXPLICIT_CENTRAL_DIFFERENCE)
    KRATOS_CREATE_VARIABLE(int, EXPLICIT_STRESS_UPDATE_OPTION)
    KRATOS_CREATE_VARIABLE(bool, CALCULATE_EXPLICIT_MP_STRESS)
    KRATOS_CREATE_VARIABLE(bool, EXPLICIT_MAP_GRID_TO_MP)
    KRATOS_CREATE_VARIABLE(bool, IS_FIX_EXPLICIT_MP_ON_GRID_EDGE)

    // Stabilization variables
    KRATOS_CREATE_VARIABLE(int, STABILIZATION_TYPE)

    // For friction
    KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( STICK_FORCE )
    KRATOS_CREATE_VARIABLE(int, FRICTION_STATE)
    KRATOS_CREATE_VARIABLE(double, TANGENTIAL_PENALTY_FACTOR)
    KRATOS_CREATE_VARIABLE(bool, FRICTION_ACTIVE)
    KRATOS_CREATE_VARIABLE(bool, FRICTION_ASSIGNED)
    KRATOS_CREATE_VARIABLE(bool, HAS_INITIAL_MOMENTUM)
    KRATOS_CREATE_VARIABLE(bool, INITIAL_LOOP_COMPLETE)
}
